package com.liancheng.smarthome.base;

import android.view.View;

/**
 * 标题的事件，包括点击，赋值等
 */
public class TitleEventModule {

    private TitleEventListener.OnClickLeftImg clickLeftImg;
    private TitleEventListener.OnClickCenterTitle centerTitle;
    private TitleEventListener.OnClickRightImage rightImage;
    private TitleEventListener.OnClickRightTitle rightTitle;

    public TitleEventModule(TitleEventListener.OnClickLeftImg clickLeftImg) {
        this.clickLeftImg = clickLeftImg;
    }

    public TitleEventModule(TitleEventListener.OnClickRightTitle rightTitle) {
        this.rightTitle = rightTitle;
    }

    public TitleEventModule(TitleEventListener.OnClickLeftImg clickLeftImg, TitleEventListener.OnClickRightTitle rightTitle) {
        this.clickLeftImg = clickLeftImg;
        this.rightTitle = rightTitle;
    }

    public TitleEventModule(TitleEventListener.OnClickLeftImg clickLeftImg, TitleEventListener.OnClickCenterTitle centerTitle, TitleEventListener.OnClickRightImage rightImage, TitleEventListener.OnClickRightTitle rightTitle) {
        this.clickLeftImg = clickLeftImg;
        this.centerTitle = centerTitle;
        this.rightImage = rightImage;
        this.rightTitle = rightTitle;
    }

    public void setClickLeftImg(TitleEventListener.OnClickLeftImg clickLeftImg) {
        this.clickLeftImg = clickLeftImg;
    }

    public void setCenterTitle(TitleEventListener.OnClickCenterTitle centerTitle) {
        this.centerTitle = centerTitle;
    }

    public void setRightImage(TitleEventListener.OnClickRightImage rightImage) {
        this.rightImage = rightImage;
    }

    public void setRightTitle(TitleEventListener.OnClickRightTitle rightTitle) {
        this.rightTitle = rightTitle;
    }

    //    BaseActivity activity;
//
//    public TitleEventModule(BaseActivity activity) {
//        this.activity = activity;
//    }
//点击右侧文本标题
    public void clickRightTitle(View v){
        if(rightTitle == null) return;
        rightTitle.clickRightTitle();
    }

    //点击左侧返回图标
    public void clickLeftImg(View v){
        if(clickLeftImg == null) return;
        clickLeftImg.clickLeftImg();
    }
//点击中间的标题
    public void clickCenterTitle(View v){
        if(centerTitle == null) return;
        centerTitle.clickCenterTitle();
    }
    //点击右侧图标
    public void clickRightImage(View v){
        if(rightImage == null) return;
        rightImage.clickRightImage();
    }

}
